<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
</head>
<body>
<a href="index.html">返回</a>
<div class="app">
    <h2>测试键盘事件 </h2>
    <input placeholder="按回车提示输入" @keyup.回车="show"/>
<!--  exact,  enter,esc,delete,space,tab,up,down,left,right-->
</div>
<script>
    Vue.config.productionTip=false  //关闭生产状态提示
    //自定义别名
    Vue.config.keyCodes.回车 = 13
    const x=new Vue({
        data:function (){
            return{
                name:"老杨"
            }
        },
        methods:{
            show(event){
                console.log(event.target.value,event.key,event.keyCode)
            }
        }
    })
        x.$mount(".app")//挂载方式
</script>
</body>
</html>